package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.AllianceSetlDetail;
import com.eling.elcms.travel.service.IAllianceSetlDetailManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class AllianceSetlDetailController extends BaseFormController{

	@Autowired
	private IAllianceSetlDetailManager allSetlDetManager;
	
	@RequestMapping("/api/alliancesetldetail/save")
    @ResponseBody
	public AllianceSetlDetail save(@ModelAttribute@ModelFilling AllianceSetlDetail cond){
		return allSetlDetManager.save(cond);
	}
	
	@RequestMapping("/api/alliancesetldetail/{pkAllianceSetlDetail}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkAllianceSetlDetail){
		allSetlDetManager.remove(pkAllianceSetlDetail);
		return new Msg("删除成功");
	}
	
	@RequestMapping("/api/alliancesetldetail/query")
    @ResponseBody
	public List<AllianceSetlDetail> query(@ModelAttribute AllianceSetlDetail cond){
		return allSetlDetManager.query(cond);
	}
	
	@RequestMapping("/api/alliancesetldetail/search*")
	@ResponseBody
	public List<AllianceSetlDetail> search(@ModelAttribute SearchCondition sc,@ModelAttribute AllianceSetlDetail cond){
		sc.setQueryCondition(cond);
		return allSetlDetManager.search(sc);
	}
	
}
